<?php
class CustomerModel extends Model{
    public function __construct() {
        parent::__construct();
    }
    
    public function add_task($data, $type, $creator) {
        $query = mysql_query("INSERT INTO task (name, link, type, user_id) VALUES (
            '".$data['title']."',
            '".$data['link']."',
            '".$type."', ".$creator.")");

        if($query) 
            return mysql_insert_id();
        else
            return FALSE;
    }
    public function add_task_extended($data,$id_parent) {
        $query = mysql_query("INSERT INTO task_extended (id_task, description, answer_type, checking_mode, answer) VALUES (
            ".$id_parent.",
            '".$data['description']."',
            ".$data['replytype'].",
            ".$data['testtype'].",
            '".$data['answer']."')");
      
        if($query) 
            return TRUE;
        else
            return FALSE;
    }
    public function add_task_socialnetworks($data,$id_parent) {
        $query = mysql_query("INSERT INTO task_socialnetworks (id_task, networktype) VALUES (
            ".$id_parent.",
            '".$data['network_type']."')");
        if($query) 
            return TRUE;
        else
            return FALSE;
    }
    public function add_task_twitter($data,$id_parent) {
        $query = mysql_query("INSERT INTO task_twitter (id_task, followers, tweets) VALUES (
            ".$id_parent.",
            ".$data['followers'].",
            ".$data['tweets'].")");
        if($query) 
            return TRUE;
        else
            return FALSE;
    }
    public function add_task_surfing($data,$id_parent) {
        $query = mysql_query("INSERT INTO task_twitter (id_task, vtime) VALUES (
            ".$id_parent.",
            ".$data['vtime'].")");
        if($query) 
            return TRUE;
        else
            return FALSE;
    }
    public function add_task_test($data,$id_parent) { 
            return TRUE;
    } 
    
}
?>
